﻿@using OBUCare.Web.Models;
@using OBUCare.Core.Models;
@using OBUCare.Web.Infrastructure;
@using OBUCare.Core.Common;
@model View_TRANSFER_BILL_Info
@{
    bool isPreveiw = (bool)ViewBag.IsPreView;
    ObuDropDownListHlper ddlHelper = new ObuDropDownListHlper();

    //var operatorInfo = UIUtility.GetCurrentUser();

    //var menuNames = ViewData["menuNames"];

    //string AgentNo = UIUtility.getAgentByModule(operatorInfo, menuNames.ToString());        
}
<link href="../../Content/Site.css" rel="stylesheet" type="text/css" />
<table>
    <tr>
        <td>
            交接人：
            @Html.HiddenFor(model => model.ID)
        </td>
        <td>
            @if (isPreveiw)
            {
                @Html.HiddenFor(model => model.OPERATOR_NO)
                @Html.DisplayFor(model => model.Deliver_OPERATOR)
            }
            else
            { 
                @Html.Telerik().DropDownListFor(model => model.OPERATOR_NO).BindTo(ddlHelper.GetOperators(null, false, null))
                //@Html.Telerik().DropDownListFor(model => model.OPERATOR_NO).BindTo(ViewBag.AllOperators as IEnumerable<SelectListItem>)                        
                @Html.HiddenFor(m => m.Deliver_OPERATOR)
                //Html.DropDownListFor(Model=>Model.OPERATOR_NO,ViewBag.AllOperators as IEnumerable<SelectListItem>)*
            }
        </td>
        <td>
            日期：
        </td>
        <td>
            @if (isPreveiw)
            {
                @Html.HiddenFor(model => model.TRANSFER_DATE)
                @Html.DisplayFor(model => model.TRANSFER_DATE).ToString().AsDateTime().ToString("yyyy/MM/dd")
            }
            else
            { 
                @Html.Telerik().DatePickerFor(model => model.TRANSFER_DATE).ShowButton(false).OpenOnFocus(true).Value(DateTime.Now.ToString("yyyy/MM/dd"))
            }
        </td>
    </tr>
</table>
    @if (isPreveiw)
    {
        if (Model.ConfirmCommandTitle.IsNullOrEmpty())
        {  
        <button type="button" class="t-button t-state-default" id="btnSubmit" style="display: none;">交接</button>
        }
        else
        {
            if ((Model.TRANSFER_TYPE == TransferType.AgentToRepairCenter.ToInt() && Model.STATUS == TransferStatus.Normal.ToInt() && ViewBag.Agent == "") ||
                (Model.TRANSFER_TYPE == TransferType.RepairCenterToAgent.ToInt() && Model.STATUS == TransferStatus.Normal.ToInt() && ViewBag.Agent != ""))
            {//交接方向 营业厅->维修组 且交接单正常 并且权限是维修组或者 交接方向维修组->营业厅 且交接单正常 且权限是营业厅 则显示按钮 
        <button id="btnSubmit" type="button" class="t-button t-state-default" onclick="btnCheckRecive()"  >确认接收</button> 
            }
        }
            
        <button id="btnPrint" type="button" class="t-button t-state-default" onclick="onPrint()">打印</button>
        <button  id="btnClose" type="button" class="t-button t-state-default" onclick="CloseWindow()">关闭</button>
    }
    else
    { 
        <button  id="btnSubmit" type="button" class="t-button t-state-default">交接</button>
        <button id="btnPrint" type="button" class="t-button t-state-default" onclick="onPrint()">打印预览</button>
        <button id="btnClose" type="button" class="t-button t-state-default" onclick="CloseWindow()">关闭</button>
    }
 
<script type="text/javascript">
    function getDropDownListText() {
        var ddlOperator = $('#OPERATOR_NO').data('tDropDownList');
        $('#Deliver_OPERATOR').val(ddlOperator.text());

        var ddlReceiver = $('#RECEIVE_OPERATOR_NO').data('tDropDownList');
        $('#RECEIVE_OPERATOR').val(ddlReceiver.text());

    }

</script>
@{
    ddlHelper.Dispose();    
}
